package db;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

public class Record
{
	private Map<String,Object> fields;
	
	public Record()
	{
		fields = new HashMap<String, Object>();
	}
	
	public Record(int id)
	{
		fields = new HashMap<String, Object>();
		fields.put("id", id);
	}
	
	public void addField(String fieldName, Object value)
	{
		fields.put(fieldName, value);
	}
	
	
	public Object getFieldValue(String field)
	{
		return fields.get(field.toUpperCase());
	}
	
	public String[] getFields()
	{
		String[] fieldArray = new String[fields.size()];
		int count = 0;
		for (Entry<String, Object> s : fields.entrySet())
		{
			fieldArray[count] = s.getKey();
			count++;
		}
		return fieldArray;
	}
	
}
